﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="OptionParameter.cs" company="Matthias Friedrich">
//   Copyright © Matthias Friedrich 2013
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace CommandlineHandling
{
    using System;

    public class OptionParameter
    {
        public OptionParameter()
        {
        }

        public string Name { get; set; }

        public string Value { get; set; }

        #region Operators

        public static explicit operator bool(OptionParameter p)
        {
            return p.GetValue<bool>();
        }

        public static explicit operator short(OptionParameter p)
        {
            return p.GetValue<short>();
        }

        public static explicit operator char(OptionParameter p)
        {
            return p.GetValue<char>();
        }

        public static explicit operator int(OptionParameter p)
        {
            return p.GetValue<int>();
        }

        public static explicit operator long(OptionParameter p)
        {
            return p.GetValue<long>();
        }

        public static explicit operator byte(OptionParameter p)
        {
            return p.GetValue<byte>();
        }

        public static explicit operator float(OptionParameter p)
        {
            return p.GetValue<float>();
        }

        public static explicit operator double(OptionParameter p)
        {
            return p.GetValue<double>();
        }

        public static explicit operator decimal(OptionParameter p)
        {
            return p.GetValue<decimal>();
        }

        public static explicit operator DateTime(OptionParameter p)
        {
            return p.GetValue<DateTime>();
        }

        #endregion
    }
}